<?php 
class AdminSupplierDSBase extends AbstractDSBase
{
	/**
	 * The AdminSupplierEntity Object will be created before calling create function
	 *
	 * @access public
	 *
	 * @return AdminSupplierEntity object
	 *
	 */
	public function beforeCreate()
	{
		// New AdminSupplierEntity
		$pageEntity = new AdminSupplierEntity();
		$pageEntity = parent::beforeInsert($pageEntity);

		// Return AdminSupplierEntity
		return $pageEntity;
	}

	/**
	 * The AdminSupplierEntity Object will be getted item from database before calling update function
	 *
	 * @access public
	 *
	 * @param int $id: Id of the page
	 *
	 * @return AdminSupplierEntity object
	 *
	 */
	public function beforeUpdate($id)
	{
		// Get page item
		$pageEntity = $this->getById($id);

		// Return AdminBlogEntity
		return $pageEntity;
	}

	/**
	 * Insert new row to service
	 *
	 * @access public
	 *
	 * @param AdminSupplierEntity $pageEntity: object to be inserted
	 *
	 * @return array of primary key of new inserted row
	 */
	public function create ($adminSupplierEntity)
	{
		// New Data Access of service
		$adminSupplierDataAccess = new AdminSupplierDataAccess();

		// Create service and return
		return $adminSupplierDataAccess->create($adminSupplierEntity);
	}

	/**
	 * Update an existing row of adminBlog
	 *
	 * @access public
	 *
	 * @param AdminSupplierEntity $adminSupplierEntity: object to be updated
	 *
	 * @return bool
	 */
	public function update ($adminSupplierEntity)
	{
		// New Data Access of adminBlog
		$adminBlogDataAccess = new AdminBlogDataAccess();

		// Update service item and return
		return $adminBlogDataAccess->update($adminBlogEntity);
	}

	/**
	 * Delete an existing row of adminBlog
	 *
	 * @access public
	 *
	 * @param int $id: id of row need to be deleted
	 *
	 * @return bool
	 */
	public function del ($id)
	{
		// New Data Access of adminSupplier
		$adminSupplierDataAccess = new AdminSupplierDataAccess();
		$result = false;
		if (!is_null($id)){

			// Detele adminSupplier and return
			$result = $adminSupplierDataAccess->del($id);
		}

		return $result;
	}

	/**
	 * Get adminSupplier item
	 *
	 * @access public
	 *
	 * @param int $id: Id of adminBlog
	 *
	 * @return AdminBlogEntity object
	 */
	public function getById ($id)
	{
		// New Data Access of adminBlog
		$adminSupplierDataAccess = new AdminSupplierDataAccess();

		// Get adminBlog item and return
		return $adminSupplierDataAccess->getById($id);
	}

	/**
	 * Get all rows of adminBlog table with search criterias
	 *
	 * @access public
	 *
	 * @param array $arrElement: array of search criterias
	 * @param string $orderby: Field and the way ordered (ASC or DESC)
	 * @param int $begin: Begin item
	 * @param int $limit: Number rows to query
	 * @param string $where: added where string
	 * @param string $having: 
	 * 
	 * @return array AdminBlogEntity object
	 */
	public function getItems($arrElement, $orderby = null, $begin = null, $limit = null, $where = null, $having = null)
	{
		// New Data Access of service
		$adminSupplierDataAccess = new AdminSupplierDataAccess();

		// Get all adminBlog based on search criterias
		return $adminSupplierDataAccess->getItems($arrElement, $orderby, $begin, $limit, $where, $having);
	}

	/**
	 * Get total items of adminBlog
	 *
	 * @access public
	 *
	 * @param array $arrElement: array of search criterias
	 *
	 * @return int total: Num of rows of adminBlog
	 */
	public function getTotals($arrElement)
	{
		// New Data Access of adminSupplier
		$adminSupplierDataAccess = new AdminSupplierDataAccess();

		// Get total items of adminSupplier based on search criterias and return
		return $adminSupplierDataAccess->getTotals($arrElement);
	}
}